package com.boarsoft.boar.soagov.app.action;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.boarsoft.bean.ReplyInfo;
import com.boarsoft.boar.app.action.AppBaseAction;
import com.boarsoft.boar.entity.AppInfo;
import com.boarsoft.boar.soagov.entity.AppSoagovInfo;
import com.boarsoft.common.Authorized;
import com.boarsoft.common.dao.PagedResult;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

@RestController
@RequestMapping("/app")
public class AppSoagovAction extends AppBaseAction {
	/**
	 * 保存AppDeployInfo时，需从parentId开始，向上找到ProjInfo
	 * 
	 * @param parentId
	 * @param o
	 * @return
	 */
	@RequestMapping("/save.do")
	@Authorized(code = "app.save")
	public ReplyInfo<Object> save(String parentId, AppSoagovInfo o) {
		return super.save(parentId, o);
	}

	/**
	 * 分页查询所有的APP
	 * 
	 * @return
	 */
	@JsonIgnoreProperties({ "svcs", "libs", "insts", "apps", "files", "protocols" })
	@RequestMapping("/list.do")
	@Authorized(code = "app.list")
	public ReplyInfo<Object> list(String id, String projId, String key, String orderBy, int pageNo, int pageSize) {
		PagedResult<AppInfo> pr = appBiz.list(id, projId, key, orderBy, pageNo, pageSize);
		return new ReplyInfo<Object>(true, pr);
	}
}